## 16Min
tele=[]
pinyin={'ling':0,'yi':1,'er':2,'san':3,'si':4,'wu':5,'liu':6,'qi':7,'ba':8,'jiu':9}
for i in range(11):
    sget=input()
    if 'sqrt' in sget:
        ans=int(int(sget[4:])**0.5)
    elif '^' in sget:
        sget=sget.replace('^','**')
        ans=eval(sget)
    elif sget.isalpha():
        ans=pinyin[sget]
    else:
        ans=int(eval(sget))
    
    tele.append(ans)

print(*tele,sep='')